﻿using SharpGraphT.Graph.Builder;
using SharpGraphT.Util;

namespace SharpGraphT.Graph;

public class DefaultDirectedGraph<TV, TE> : AbstractBaseGraph<TV, TE>
    where TE : class, new() {
    private static readonly long SerialVersionUid = -2066644490824847621L;

    public DefaultDirectedGraph() : this(null,
        SupplierUtil.CreateSupplier<TE>(), false) { }

    public DefaultDirectedGraph(Func<TV> vertexSupplier, Func<TE> edgeSupplier,
        bool weighted) : base(vertexSupplier, edgeSupplier,
        new DefaultGraphType.Builder().Directed().AllowMultipleEdges(false)
            .AllowSelfLoops(true).Weighted(weighted).Build()) { }

    public static GraphBuilder<TV, TE, DefaultDirectedGraph<TV, TE>>
        CreateBuilder()  =>
        new(new DefaultDirectedGraph<TV, TE>());

    public static GraphBuilder<TV, TE, DefaultDirectedGraph<TV, TE>>
        CreateBuilder(Func<TE> edgeSupplier)  =>
        new(new DefaultDirectedGraph<TV, TE>(null, edgeSupplier, false));
}